fi = open("dir_300.txt","r")
data = {}
for i in fi:
    i = i.replace("\n","")
    value = i.split("_")
    temp = eval(value[0])
    id = []
    num = value[1][:-4]
    for i in temp:
        if i != "0":
            id.append(i);
    data[num] = id
fi.close()
for i,j in data.items():
    print("{}:{}".format(i,",".join(j)))


new_data = {};
for i in data.values():
    for j in i:
        new_data[j] = new_data.get(j,0) + 1
sum = 0;
for i in new_data:
    print("{}:{}".format(i,new_data[i]))
    sum += new_data[i]
print("实际参加测试的人数是:{}\n人均被测人数是{:.1f}".format(len(new_data),sum/len(new_data)))

    
